<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        //声明一个set
        let s = new Set();
        //里面如果有相同元素的话，会直接去重！！！
        let s2 = new Set(['大事儿', '小事儿', '好事儿', '坏事儿', '小事儿']);
        console.log(s2);
        //元素个数
        console.log(s2.size);
        //添加新的元素
        s2.add('糟心事儿');
        //检测
        console.log('@@@',s2.has('小事儿'));
        //清空
        // s2.clear();
        console.log('###',s2);

        //遍历
        for (let v of s2) {
            console.log(v);
        }



    </script>


</body>

</html>